﻿#region itdc

/************************************************************************
*Copyright(C) 2015 by qsgy
 *All rights reserved. 
 *FileName:     $safeitemname$
 *Author:       oyh
 *Version:      
 *UnityVersion：
 *Date:   $time$      
 *Description:    
 *History: 
************************************************************************/
#endregion
using UnityEditor;
using UnityEngine;

[CustomEditor(typeof(PatrolState))]
public class PatrolHandle : Editor {
    PatrolState ps;
    private void OnEnable()
    {
        ps = (PatrolState)target;
    }
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
    }
    private void OnSceneGUI()
    {
        ps.reach = Handles.RadiusHandle(Quaternion.identity, ps.transform.position, ps.reach);
        for (int i = 0; i < ps.tagerts.Length; i++)
        {
            ps.tagerts[i] = Handles.PositionHandle(ps.tagerts[i], Quaternion.identity);
        }
        if (GUI.changed)
        {
            Debug.Log("changged");
            EditorUtility.SetDirty(target);
        }
        new SerializedObject(ps).ApplyModifiedProperties();
        
    }

}
